using System.Collections.Generic;
using System;
using Castle.ActiveRecord;
using CosyTrade.Data;

namespace CosyTrade.Distribution
{
    [Serializable,ActiveRecord("tbRegionDetails")]
    [AddPropertyChangedNotifyInterface,PropertyChangedNotify]
    public class Region : RegionBase
    {
        private readonly IList<RegionBase> childsRegion = new List<RegionBase>();

        [JoinedKey("ROWGUID")]
        public Guid RelationKey
        {
            get { return PrimaryKey; }
        }

        [HasMany(typeof(RegionBase), ColumnKey = "Details", Table = "tbRegionDetails", Access = PropertyAccess.NosetterCamelcase, Cascade = ManyRelationCascadeEnum.Delete)]
        public IList<RegionBase> ChildsRegion
        {
            get { return childsRegion; }
        }
    }
}